package com.swf.common.utils;

import java.util.*;
import java.util.Map.Entry;
import java.util.Map.*;

/**
 * description:
 * @version 1.0 2013-5-20
 * @author shenwf
 */
public final class FwsCollectionUtils {
	
	/**
	 * 禁用默认构造器	
	 */
	private FwsCollectionUtils() {
	}
	
	/**
	 * 根据map获取所有key
	 * @param map
	 * @return
	 */
	public static String[] getStringMapKeys(Map map){
		String[] keys = new String[map.size()];
		int i=0;
		Iterator it = map.entrySet().iterator();
		while (it.hasNext()){
			Entry entry = (Entry) it.next();
			keys[i++] = (String) entry.getKey();
		}
		return keys;
	}
	

	/**
	 * 根据map获取所有key
	 * @param map
	 * @return
	 */
	public static Set<String> getSetMapKeys(Map map){
		Set set = new HashSet<String>();
		int i=0;
		Iterator it = map.entrySet().iterator();
		while (it.hasNext()){
			Entry entry = (Entry) it.next();
			set.add((String)entry.getKey());
		}
		return set;
	}
}
